import { MyApp } from './app.component';
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';
import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http";
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { IonicStorageModule } from '@ionic/storage';

import * as ionicGalleryModal from 'ionic-gallery-modal';
import { MultiPickerModule } from 'ion-multi-picker';
import { IonicImageLoader } from 'ionic-image-loader';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { CodePush } from '@ionic-native/code-push';
import { Device } from '@ionic-native/device';
import { JPush } from '@jiguang-ionic/jpush';

import { WechatProvider } from '../providers/wechat/wechat';
import { EventProvider } from '../providers/event/event';
import { StorageProvider } from '../providers/storage/storage';
import { DialogProvider } from '../providers/dialog/dialog';
import { HttpProvider } from '../providers/http/http';
import { HttptimingProvider } from '../providers/httptiming/httptiming';
import { Sha1Provider } from '../providers/sha1/sha1';
import { FilesProvider } from '../providers/files/files';
import { UnitsProvider } from '../providers/units/units';
import { CodepushProvider } from '../providers/codepush/codepush';
import { JpushProvider } from '../providers/jpush/jpush';
import { AmapProvider } from '../providers/amap/amap';
import { ImagesProvider } from '../providers/images/images';
import { JmessageProvider } from '../providers/jmessage/jmessage';

@NgModule({
	declarations: [
		MyApp
	],
	imports: [
		BrowserModule,
		HttpClientModule,
		ionicGalleryModal.GalleryModalModule,
		MultiPickerModule,
		IonicImageLoader.forRoot(),
		IonicModule.forRoot(MyApp, {
			backButtonText: '返回', //定义返回按钮名称
			tabsHideOnSubPages: 'true',
			iconMode: 'ios',
			mode: 'ios',
		}),
		IonicStorageModule.forRoot({
			name: '__mydb',
			driverOrder: ['indexeddb', 'sqlite', 'websql']
		})
	],
	bootstrap: [IonicApp],
	entryComponents: [
		MyApp
	],
	providers: [
		StatusBar,
		SplashScreen,
		CodePush,
		Device,
		JPush,
		[
			{ provide: ErrorHandler, useClass: IonicErrorHandler },
			{ provide: HTTP_INTERCEPTORS, useClass: HttptimingProvider, multi: true },
			{ provide: HAMMER_GESTURE_CONFIG, useClass: ionicGalleryModal.GalleryModalHammerConfig },
		],
		WechatProvider,
		EventProvider,
		StorageProvider,
		DialogProvider,
		HttpProvider,
		HttptimingProvider,
		Sha1Provider,
		FilesProvider,
		UnitsProvider,
		CodepushProvider,
		JpushProvider,
		AmapProvider,
		ImagesProvider,
		JmessageProvider,
	]
})
export class AppModule {}